package com.zr.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zr.dao.BaseDao;
import com.zr.dao.FuncDAO;
import com.zr.datamodel.FuncDM;
import com.zr.datamodel.RoleDM;
import com.zr.service.FuncService;
import com.zr.service.RoleService;

import net.sf.json.JSONArray;

@Service("funcService")
public class FuncServiceImpl implements FuncService {

	@Resource
	private FuncDAO funcDao;

	@Resource
	private RoleService roleService;
	
	@Override
	public List<FuncDM> findFuncsByRoleId(int id) {
		RoleDM role = roleService.findRoleById(id);
		List<FuncDM> funcs = role.getFuncs();
		return funcs;
	}

	@Override
	public JSONArray queryAllFunc(int parentId) {
		return funcDao.getAllFuncById(parentId);
	}

}
